#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#define N 81
int main()
{
	int first, end, count = 0;
	char str[N], ch;
	void find(char str[], char ch, int* first, int* end, int* count);
	printf("Please input a string of characters(length<80):");
	gets(str);
	printf("Please input a number that you want to inquire:");
	ch = getchar();
	find(str, ch, &first, &end, &count);
	printf("Inquire '%c' in \"%s\" \nit appears for the first time is %d,it appears for the last time is %d,it totally appears %d times",ch,str,first,end,count);
	return 0;
}

void find(char str[], char ch, int *first, int *end, int *count)
{
	int i;
	for (i = 0; str[i] != '\0'; i++)
	{
		if (str[i] == ch)
		{
			*first = i + 1; break;
		}
	}
	for (i = 0; str[i] != '\0'; i++)
	{
		if (str[i] == ch)
		{
			*end = i + 1;
			(*count)++;
		}
	}
}